gust_list =['zhangsan','lisi','wangwu',]
name = gust_list [0].title
print(f"{name()},please come to diner\n")
name = gust_list [1].title
print(f"{name()},please come to diner\n")
name = gust_list [2].title
print(f"{name()},please come to diner\n")
print(f"第一次邀请{len(gust_list)}个客人")

print(f"{gust_list[0]} cannot come\n")
del(gust_list[0])
gust_list.insert(0,'zhaoliu')
name = gust_list [0].title
print(f"{name()},please come to diner\n")
name = gust_list [1].title
print(f"{name()},please come to diner\n")
name = gust_list [2].title
print(f"{name()},please come to diner\n")

print("\nWe got a bigger table!")
gust_list.insert(0,'zhaoliu')
gust_list.insert(2,'sunqi')
gust_list.append('zhengshi')
print(gust_list)
print(f"第二次邀请{len(gust_list)}个客人")
# 使用pop()不断地删除名单中的嘉宾，直到只有两位嘉宾为止。每次从名单中弹出一位
# 嘉宾时，都打印一条消息，让该嘉宾知道你很抱歉，无法邀请他来共进晚餐。
print("\nSorry, we can only invite two people to dinner.")
name = gust_list.pop()
print(f"Sorry, {name.title()}  there's no room at the table.")
name = gust_list.pop()
print(f"Sorry, {name.title()}  there's no room at the table.")
name = gust_list.pop()
print(f"Sorry, {name.title()}  there's no room at the table.")
name = gust_list.pop()
print(f"Sorry, {name.title()}  there's no room at the table.")
print(f"实际到{len(gust_list)}个客人")
# 对于余下两位嘉宾中的每一位，都打印一条消息，指出他依然在受邀之列。
name = gust_list[0]
print(f"{name.title()}, please come to diner!")
name = gust_list[1]
print(f"{name.title()}, please come to diner!")

# 使用del将最后两位嘉宾从名单中删除，让名单变成空的。打印该名单，核实名单在程
# 序结束时确实是空的。
del(gust_list[0])
del(gust_list[0])
print(gust_list)